#include<iostream>
#include<memory>
#include<string>

using namespace std;

class Person{
    private:
        int age{18};
        string name{"qq"};
    public:
        Person(){}
        Person(int n,string strs):age(n),name(strs){}
        ~Person(){}
        void show(){
            cout<<"姓名："<<name<<"  年龄："<<age<<endl;
        }
};

int main(){
    Person *p=new Person(1,"zyh");
    shared_ptr<Person> p1(p);
    shared_ptr<Person> p2=p1;
    shared_ptr<Person> p3(std::move(p2));

    cout<<"p1:"<<p1.use_count()<<endl;
    cout<<"p2:"<<p2.use_count()<<endl;
    cout<<"p3:"<<p3.use_count()<<endl;
    p->show();

    shared_ptr<Person> p4=make_shared<Person>(2,"abc");
    cout<<"p4:"<<p4.use_count()<<endl;

    Person pp1;
    Person && pp=std::move(pp1);
    pp1.show();
    pp.show();


    return 0;
}